package main.java.flyweight;

/**
 * 享元模式
 */
public class Demo {
    public static void main(String[] args) {
        AbstartBox box1 = BoxFactory.getInstance().getShape("I");
        box1.display("灰色");
        AbstartBox box2 = BoxFactory.getInstance().getShape("O");
        box2.display("红色");
        AbstartBox box3 = BoxFactory.getInstance().getShape("L");
        box3.display("绿色");
        AbstartBox box4 = BoxFactory.getInstance().getShape("L");
        box4.display("粉色");

        System.out.println(box3 == box4);
    }
}
